package com.example.studentmanagement.dao;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class LoginDao {

    /**
     * 登陆学生账号
     * @param db
     * @param selectionArgs
     * @return
     */
    public static int LoginUse(SQLiteDatabase db,String ...selectionArgs){
        String selection="s_id=? and s_pwd=?";
        Cursor cursor=db.query("d_student",null,selection,selectionArgs,null,null,null);
        int a=0;
        while(cursor.moveToNext()){
            a++;
        }
        return a;
    }

    /**
     *
     * @param dbd
     * @param selectionArgs
     * @return
     */
    public static int LoginMan(SQLiteDatabase dbd,String ...selectionArgs){
        String selection="d_id=? and d_pwd=?";
        Cursor cursor=dbd.query("d_admin",null,selection,selectionArgs,null,null,null);
        int a=0;
        while(cursor.moveToNext()){
            a++;
        }
        return a;
    }


}
